home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9210 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: nntp.uib.no!usenet
  2. From: magnus@due.ii.uib.no (Magnus Y Alvestad)
  3. Newsgroups: comp.lang.misc,comp.lang.c
  4. Subject: Re: GOTO controversy
  5. Date: 08 Mar 1996 20:35:37 +0100
  6. Organization: Department of Informatics
  7. Message-ID: <evlolbgyye.fsf@due.ii.uib.no>
  8. References: <rcshlds.1.000A6705@mailserv.mta.ca> <Dn8pJ8.nqs@emi.net>
  9.     <4grt4e$8fg@goanna.cs.rmit.EDU.AU> <4hl8mt$4po@newshost.cyberramp.net>
  10.     <DnwCxp.84C@clw.cs.man.ac.uk>
  11. Reply-To: magnus@ii.uib.no
  12. NNTP-Posting-Host: due.ii.uib.no
  13. X-Newsreader: September Gnus v0.45/Emacs 19.30
  14.  
  15. [Charles]
  16.  
  17. | Well that is what I thougut when I first saw the example, and
  18. | I was about to dash off an article like you have done. But
  19. | then I looked again and saw *exactly* what it was doing.
  20.  
  21. | So if you believe there is a better way, please can we see
  22. | it?
  23.  
  24. This seems to do the same thing to me, but I may have misunderstood
  25. the original code.
  26.  
  27. HEV    hev1, hev2, hev3;     /* Event semaphores */
  28. HMTX   hmtx;                 /* Mutex semaphore  */ 
  29. void  *ptr;              
  30.  
  31. if (DosCreateEventSem(0, &hev1, 0, FALSE))
  32.   { if (DosCreateEventSem(0, &hev2, 0, FALSE))
  33.     { if (DosCreateEventSem(0, &hev3, 0, FALSE))
  34.       { if (DosCreateMutexSem(0, &hmtx, 0, FALSE))
  35.         { if ((ptr = malloc(SOME_SIZE)) == NULL)
  36.           return TRUE; /* We did okay */
  37.         DosCloseMutexSem(hmtx); }
  38.       DosCloseEventSem(hev3); }
  39.     DosCloseEventSem(hev2); }
  40.   DosCloseEventSem(hev1); }
  41. return FALSE;
  42.  
  43. -Magnus
  44.